﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using XNAFight.Characters.Core;


namespace XNAFight.Engine
{
    public class AnimationData
    {
        #region CHAMPS

        private string nomAnimation;
        
        private string nomTexture;
        private Texture2D texture;
        private int nbFrames;
        private int startingFrame;
        private int endingFrame;
        private int widthFrame;
        private bool loop;
        private float frameParSec;
        private bool sensInverse;
        private float tempsAnime;

        private Vector2 origine;

        private BoxesData boites;

        #endregion

        #region CONSTRUCTEUR

        public AnimationData()
        {
            nomAnimation = "";
            nomTexture = "";
            nbFrames = 0;
            startingFrame = 0;
            widthFrame = 0;
            loop = false;
            frameParSec = 0;
            sensInverse = false;
            endingFrame = 0;
            tempsAnime = 0.0f;
            origine = Vector2.Zero;

            boites = new BoxesData(nomAnimation, nbFrames);
        }
        
        public  AnimationData(string _nomAnimation, string _nomTexture, int _nbFrames, int _startingFrame, int _widthFrame, Vector2 _origine, bool _loop, bool _sensInverse, float _tempsAnime)
        {
            nomAnimation = _nomAnimation;
            nomTexture = _nomTexture;
            nbFrames = _nbFrames;
            startingFrame = _startingFrame;
            widthFrame = _widthFrame;
            origine = _origine;
            loop = _loop;
            sensInverse = _sensInverse;
            endingFrame = _startingFrame + _nbFrames - 1;
            tempsAnime = _tempsAnime;

            boites = new BoxesData(nomAnimation, nbFrames);
        }

        #endregion


        #region PROPRIETES

        public string NomTexture
        {
            get { return nomTexture; }
        }
        public string NomAnimation
        {
            get { return nomAnimation; }
        }
        public Texture2D Texture
        {
            get { return texture; }
            set { texture = value; }
        }
        public bool Loop
        {
            get { return loop; }
        }
        public int NbFrames
        {
            get { return nbFrames; }
        }
        public int StartingFrame
        {
            get { return startingFrame; }
        }
        public int WidthFrame
        {
            get { return widthFrame; }
        }
        public float FrameParSec
        {
            get { return frameParSec; }
            set { frameParSec = value; }
        }
        public bool SensInverse
        {
            get { return sensInverse; }
        }
        public int EndingFrame
        {
            get { return endingFrame; }
        }
        public float TempsAnime
        {
            get { return tempsAnime; }
            set { tempsAnime = value; }
        }
        public Vector2 Origine
        {
            get { return origine; }
        }
        public BoxesData Boites
        {
            get { return boites; }
        }

        #endregion

        #region AUTRES METHODES

        public void setFrom(AnimationData _animeSource)
        {
            nomAnimation = _animeSource.NomAnimation;
            nomTexture = _animeSource.NomTexture;
            texture = _animeSource.Texture;
            nbFrames = _animeSource.NbFrames;
            startingFrame = _animeSource.StartingFrame;
            endingFrame = _animeSource.EndingFrame;
            widthFrame = _animeSource.WidthFrame;
            loop = _animeSource.Loop;
            frameParSec = _animeSource.FrameParSec;
            sensInverse = _animeSource.SensInverse;

            tempsAnime = _animeSource.TempsAnime;
        }

        #endregion
    }
}
